import  request  from "@/request/request";
import  requestMock  from "@/request/requestMock";
//1. 请求三级分类列表
export const reqCategoryList=()=>{
    return request.get(`/product/getBaseCategoryList`)
}
//2. 请求banner的列表(MOCK请求)
export const reqBannerList=()=>{
    return requestMock.get("/banner/list")

}

//3. 请求floor的列表(MOCK请求)
export const reqFloorList=()=>{
    return requestMock.get("/floor/list")
}
// 4.请求搜索页面的数据
export const reqSearchList=(searchParams)=>{
return request.post(`/list`,searchParams)
}
//5. 请求详情页数据
export const reqDetailInfo=(skuId)=>{
return request.get(`/item/${skuId}`)
}

// 6.添加购物车或者修改购物车商品的数量
export const addOrupdateShopCart=(skuId,skuNum)=>{
return request.post(`/cart/addToCart/${skuId}/${skuNum}`)
}

//7. 获取购物车数据
export const reqShopCartList = () => {
    return request.get(`/cart/cartList`);
  };
  

  
//8. 请求修改购物车的某个商品的选中状态
export const reqCheckCart = (skuID, isChecked) => {
    return request.get(`/cart/checkCart/${skuID}/${isChecked}`);
  };
  
  //9. 请求删除购物车的某个商品
  export const reqDeleteCart = (skuId) => {
    return request.delete(`/cart/deleteCart/${skuId}`);
  };
  
  //10. 控制购物车所有商品的状态
  export const reqAllChecked = (isChecked, skuIdList) => {
    return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList);
  };
  
  //11. 批量删除购物车数据
  export const reqDeleteAll = (skuIdList) => {
    return request.delete(`/cart/batchDeleteCart`, {
      data: skuIdList,
    });
  };

  //12. 获取注册验证码
export const reqVerifyCode = (phone) => {
  return request.get(`/user/passport/sendCode/${phone}`);
};

//13. 注册请求
export const reqRegister = (userInfo) => {
  return request.post(`/user/passport/register`, userInfo);
};

//14. 登录请求
export const reqLogin = (userInfo) => {
  return request.post(`/user/passport/login`, userInfo);
};

//15.请求用户信息
export const reqUserInfo = () => {
  return request.get(`/user/passport/auth/getUserInfo`);
};

//16.退出登录
export const reqLogout = () => {
  return request.get(`/user/passport/logout`);
};

//17.请求用户地址
export const reqUserAddress = () => {
  return requestMock.get(`/address/list`);
};

//18.请求交易页的信息
export const reqTradeInfo = () => {
  return request.get(`/order/auth/trade`);
};

//20.提交订单请求
export const reqSubmitOrder = (tradeNo, orderInfo) => {
  return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, orderInfo);
};

//21.获取支付详情
export const reqPayInfo = (orderId) => {
  return request.get(`/payment/weixin/createNative/${orderId}`);
};

//22.获取支付成功的信息
export const reqPayStatus = (orderId)=>{
  return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}

// 23.获取订单的分页列表
export const reqOrderList=(page,limit)=>{
  return request.get(`/order/auth/${page}/${limit}`)
}
